###
# This software is provided 'as-is', without any express or implied
# warranty.  In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
# 
# 1. The origin of this software must not be misrepresented; you must not
#    claim that you wrote the original software. If you use this software
#    in a product, an acknowledgment in the product documentation would be
#    appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be
#    misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
#
# Note: Some of the libraries GMEngine may link to may have additional
# requirements or restrictions.
#
###

cmake_minimum_required(VERSION 2.8)

set(NAME SDL)
project(${NAME})

file(GLOB_RECURSE ROOT_HEADER *.h)
file(GLOB_RECURSE ROOT_SOURCE *.c)

set(RESOURCES
)

set(HDRS
	${ROOT_HEADER}
)

set(SRCS
	${ROOT_SOURCE}
)



add_library(${NAME} STATIC ${RESOURCES} ${HDRS} ${SRCS})
ADD_DEFINITIONS()

set(DEPENDENCY_DIR ${CMAKE_SOURCE_DIR}/depends)

include_directories(${DEPENDENCY_DIR}/zlib-1.2.7/src)
include_directories(${DEPENDENCY_DIR}/libpng-1.5.10/src)
include_directories(${DEPENDENCY_DIR}/SDL-1.2.15/include)
include_directories(${DEPENDENCY_DIR}/SDL-1.2.15/include/SDL)

find_package(OpenGL REQUIRED)

target_link_libraries(${NAME} ZLib LibPNG ${OPENGL_LIBRARY} WinMM)

IF(MSVC)
	# Since libtcod pulls in DLLs that use the release CRT, force the linker to never try to cross match CRTs
	set_property(TARGET ${NAME} PROPERTY LINK_FLAGS "/NODEFAULTLIB:MSVCRTD.lib ")
	set_property(TARGET ${NAME} PROPERTY LINKER_LANGUAGE CXX)
ENDIF()


